<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../css/api.css">
    <link rel="stylesheet" href="../css/news.css">
    <link rel="stylesheet" href="../css/jiazu.css">
    <title>Document</title>
    <style>
        html,
        body {
            background-color: #fff;
        }

        .list {
            background-color: #fff;
        }

        .list .item {
            padding: 8px 0px;
            display: flex;
        }

        .list .item .avatar {
            width: 60px;
            height: 60px;
            border-radius: 6px;
            margin-right: 8px;
        }

        .list .item .content {
            width: calc(100% - 68px);
        }

        .list .item .content .top {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
        }


        .list .item .content .top .left .name {
            font-size: 16px;
        }

        .list .item .content .top .left .num {
            font-size: 12px;
            margin-top: 3px;
        }

        .list .item .content .top .left .num .count {
            margin-right: 8px;
            color: #999;
        }

        .list .item .content .top .left .num .count .label {
            font-size: 12px;
        }

        .list .item .content .top .rightbtn {
            font-size: 10px;
            border-radius: 15px;
            padding: 2px 6px;
            border: 1px solid;
            color: #CE89FF;
        }

        .list .item .content .desc {
            width: 100%;
            font-size: 12px;
            color: #787878;

            overflow: hidden;
            white-space: normal;
            text-overflow: ellipsis;
            word-break: break-all;
            word-wrap: break-word;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            display: -webkit-box;
        }

        .search-wrap {
            background: #F7F7F7;
            border-radius: 20px;
            margin: 15px;
            padding: 10px 15px;
        }

        .search-wrap .base-icon {
            margin-right: 5px;
            width: 18px;
            height: 18px;
        }

        .search-wrap input::placeholder {
            color: #B3B3B3;
        }
    </style>
</head>

<body>
    <div id="view" v-cloak>
        <!-- <div class="search-wrap flex">
            <i class="base-icon index-search-icon "></i>
            <input type="text" readonly placeholder="大家都在搜：唛唛家族">
        </div> -->
        <div class="list">
            <div class="item" v-for="(m, index) in ffList" @click="openFamily(index)">
                <img class="avatar" :src="returnImg(m.logo)" onerror="this.src='../image/touxiang.png'" alt="">
                <div class="content">
                    <div class="top">
                        <div class="left">
                            <div class="name">{{_i18n(m.name)}}</div>
                            <div class="num">
                                <span class="count"><span class="my-icon"></span>{{m.count}}{{_i18n('人')}}</span>
                                <span class="count"><span class="label">{{_i18n('日活跃度')}}：</span>{{m.active_day}}</span>
                            </div>
                        </div>
                        <div class="rightbtn" v-if="!m.is_join">+ {{_i18n('加入')}}</div>
                        <div class="rightbtn" v-else>{{_i18n('已加入')}}</div>
                    </div>
                    <div class="desc">{{m.description}}</div>
                </div>
            </div>
        </div>
    </div>
</body>
<script src="../script/jquery.js"></script>
<script src="../script/api.js"></script>
<script src="../script/ffkj.js"></script>
<script src="../script/vue.js"></script>
<script src="../json/jiazu.js"></script>
<script>
    var view = new Vue({
        el: '#view',
        data: {
            imgurl: imgurl,
            ffList: [],
            ffInfo: {},
            ios: 1, // 1上架 0非上架
        },
        methods: {
            // 跳转
            _url: function(param, url) {
                _url(param, url);
            },
            // 返回图片路径
            returnImg: function(url) {
                return returnImg(url);
            },
            // 打开家族
            openFamily(index) {
                var _this = this;
                var data = _this.ffList[index];
                if (data.is_join == 1) {
                    openQun(data.id, data.name)
                } else {
                    _url({
                        id: data.id
                    }, 'frame0/jiazupage')
                }
            },
        }
    })
    apiready = function() {
        view.ios = $api.getStorage('shang');
        view.myuserid = $api.getStorage('userid');
        // 监听登录
        _listener('fresh', function(ret) {
            view.myuserid = $api.getStorage('userid');
        })

        _shangla(function() {
            getData(1);
        })
        _scrollToBottom(function() {
            if (heigutgao == 1) {
                pagenum++;
                getData(pagenum)
            }
        })

        _listener('viewappear', function() {
            _heibai(1)
        })
    }

    // 获取数据
    function getData(page) {
        var param = api.pageParam;
        param.user_id = $api.getStorage('userid');
        console.log(JSON.stringify(param))
        var loading = page == 1 ? 1 : 0;
        _lists('api/family/lists', page, loading, param)
    }
</script>

</html>